package com.example.springtrans.controller;

import com.example.springtrans.service.LogService;
import com.example.springtrans.service.UserService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Isolation;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.io.IOException;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: hp
 * Date: 2025-01-28
 * Time: 16:19
 */
@Slf4j
@RequestMapping("/proga")
@RestController
public class PropagationController {
    @Autowired
    private UserService userService;

    @Autowired
    private LogService logService;

    @Transactional
    @RequestMapping("/p1")
    public String p1(String name,String password)  {
        //用户注册
        Integer result = userService.insertUserInfo(name,password);
        logService.insertLog(name,"用户注册");
        return "注册成功";
    }
}
